#include "switches.h"
#include <assert.h>
#include <stdlib.h>
#include "main.h"

void room_switches_layout (Segment* segment, Layout* layout, Generator* generator)
{
	int width = 12;
	int height = 12;
	int root[MAX_ROOTS];
	int n_roots = 0;
	
	for (int i = 0; i < segment->n_roots; i++)
	{
		assert(segment->root[i]->n_rooms > 0);
		root[n_roots++] = segment->root[i]->room[0];
	}
	
	segment->room[0] = generator->gen_room (layout, width, height, root, n_roots);
	segment->n_rooms = 1;
}

void room_switches_content (Segment* segment, Layout* layout, Map* map,
                            Coord* entrance, int n_entrances,
                            Coord* exit, int n_exits)
{
	
	int room_id = segment->room[0];
	assert((room_id >= 0) && (room_id < layout->n_rooms));
	
#if TOWERHACK_DEBUG_OBJECTS
	Rect* room = &layout->room[room_id].area;
	Coord cbox1 = { room->left+3, room->top+3, room->z };
	MapObject* box1 = map_add_object (map, cbox1);
	map_object_make_treasure_gold (box1);
	segment_plant_obstacles (map, exit, n_exits);
#else
	segment_plant_obstacles (map, exit, n_exits);
#endif

	// TODO: room content
}
